/**
 * Created with JetBrains WebStorm.
 * Author: FrimYuan
 * Date: 2017/08/30
 * Time: 17:37
 */

import React, {Component} from 'react';
import {
    AppRegistry,
    StyleSheet,
    View,
    Text,
    Dimensions,
    TouchableOpacity,
} from 'react-native';

import MultiseriateTable from '../Table/MultiseriateTable'
// import SingleTable from '../Table/SingleTable'
import TextView from '../Table/TextView.js'

var {height, width} = Dimensions.get('window');
var Platform = require('Platform');


export default class MoreTable extends Component {

  static navigationOptions = ({navigation}) => ({
    headerLeft: (
      <TouchableOpacity
        onPress = {() => navigation.goBack()}
      >
        <TextView
          text = '返回'
          textStyle = {{fontSize:16, color:'#BD10E0'}}
          style = {{
            width:40,
            height:20,
            marginLeft:10,
            justifyContent:'center',
          }}
        />
      </TouchableOpacity>
    ),
    headerStyle:{backgroundColor:'#ffffff'},

    headerTitle:navigation.state.params.isDayReport?'日报详情':'月报详情',
    headerTitleStyle:(Platform.OS === 'android')?{backgroundColor: 'white',
    color: '#BD10E0',
    height: 55,
    textAlign: 'center',
    fontSize: 18,
    paddingTop: 18,
    marginRight:72,
    alignSelf: 'center', }:{},
    headerTintColor:'#BD10E0',
    tabBarVisible: true,
  })

    constructor(props) {
        super(props);
        this.state = {};
    }

    render() {
        const map = this.props.navigation.state.params.arg;
        var isDayReport = this.props.navigation.state.params.isDayReport;

        var data = [];
        for (let value of map.values()) {
          data.push(value)
        }

        return (
          <View style={[styles.container,{}]}>
            <MultiseriateTable
              data={data}
              tableType=  {isDayReport?'day':'month'}
              style={{
                backgroundColor:'white',
                width:width-20,
                height:height-64,
                marginTop:30,
              }}/>

            {/* <SingleTable /> */}
          </View>
        );
    }
}
const styles = StyleSheet.create({
    container: {
        flex: 1,
        alignItems:'center',
        justifyContent:'center',
        backgroundColor:'rgb(255, 255, 255)',
    },
    header_title:{
      backgroundColor: 'white',
      color: '#BD10E0',
      height: 55,
      textAlign: 'center',
      fontSize: 16,
      paddingTop: 18,
      alignSelf: 'center', // width of both buttons + no left-right padding
    },
    multiseriateTable:{
      backgroundColor:'white',
      width:width-20,
      height:height-64-20,
    }
});
